/*
 * @Copyright: Citylife 2021
 * @Author: shaokui.gu
 * @Date: 2021-02-21 11:44:46
 * @Description: 
 */
import 'package:dio/dio.dart';

/// DIO拦截器
/// 负责处理共通Header，签名
class NetworkRequestInterceptor extends Interceptor {
  @override
  void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
    Map<String, dynamic> requestHeaders = options.headers;
    int timestamp = new DateTime.now().millisecondsSinceEpoch;
    requestHeaders["timestamp"] = timestamp.toString();
    requestHeaders["Authorization"] = "Basic T1BFTlZJRFVBUFA6TVlfU0VDUkVU";
    options.headers = requestHeaders;
    super.onRequest(options, handler);
  }
}
